<template>
  <div class="waper">
    <div class="list">
      <div class="item">
        <p class="item-text">数字员工总数</p>
        <count-to class="item-num" :endVal="info.totalDigitNum" :delay="delay"></count-to>
      </div>
      <div class="item">
        <p class="item-text">累计执行次数</p>
        <count-to class="item-num" :endVal="info.totalExecuteTimes" :delay="delay"></count-to>
      </div>
      <div class="item">
        <p class="item-text">成功率</p>
        <count-to
          class="item-num inline-block"
          :endVal="info.successRate"
          :delay="delay"
        ></count-to>
        <p class="item-num inline-block">%</p>
      </div>
    </div>
    <div class="list">
      <div class="item">
        <p class="item-text">综合型指数</p>
        <count-to class="item-num" :endVal="info.comprehensiveNum" :delay="delay"></count-to>
      </div>
      <div class="item">
        <p class="item-text">融合型指数</p>
        <count-to class="item-num" :endVal="info.mixedNum" :delay="delay"></count-to>
      </div>
      <div class="item">
        <p class="item-text">智慧型指数 </p>
        <count-to
          class="item-num inline-block"
          :endVal="info.intelligentNum"
          :delay="delay"
        ></count-to>
      </div>
    </div>
  </div>
</template>

<script lang="ts" setup>
  import { nextTick, onMounted, ref, watch, reactive } from 'vue'
  import * as echarts from 'echarts'
  import { CountTo } from 'vue3-count-to'

  const props = defineProps({
    info: {
      type: Object,
      default: () => ({})
    }
  })
  const delay = ref<number>(2000)
  const renderChart = () => {
    const info = reactive(props.info.data)
  }
  watch(
    props,
    () => {
      renderChart()
    },
    {
      deep: true
    }
  )
  onMounted(() => {
    nextTick(() => {})
  })
</script>
<style lang="scss" scoped>
  .waper {
    width: 327px;
    height: 150px;
    background-image: url('@/assets/images/binzhou/box.png');
    background-size: cover;
    background-repeat: no-repeat;
    background-position: center center;
    display: flex;
    flex-direction: column;
    // align-items: flex-end;
    .list {
      display: flex;
      justify-content: space-around;
      align-items: center;
      padding: 20px 15px;
      &:last-child {
        padding-top: 0px !important;
      }
      .item {
        font-size: 14px;
        font-family: Microsoft YaHei;
        font-weight: 400;
        color: #ffffff;
        width: 86px;
        text-align: center;
        .item-text {
          text-align: center;
          margin-bottom: 6px;
        }
        .item-num {
          text-align: center;
          color: #00ffe3;
          font-size: 21px;
          font-family: DIN;
          font-weight: bold;
          display: block;
        }
        .inline-block {
          display: inline-block;
        }
      }
    }
  }
</style>
